home *** CD-ROM | disk | FTP | other *** search
- Path: druid.borland.com!usenet
- From: pete@borland.com (Pete Becker)
- Newsgroups: comp.lang.c++
- Subject: Re: What is name-mangling? (mentioned in FAQ)
- Date: 27 Mar 1996 17:30:22 GMT
- Organization: Borland International
- Message-ID: <4jbtve$9nk@druid.borland.com>
- References: <4ik3s1$j7q@alcor.usc.edu> <3152e97b.62546054@news.primenet.com>
- NNTP-Posting-Host: pbecker.borland.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- In article <3152e97b.62546054@news.primenet.com>, gbe@primenet.com says...
- >
- >Name-Mangling (also called decoration)
-
- It's only called "decoration" by Microsoft. The C++ community uses the term
- "name mangling".
-
- >is a method of encoding the number and
- >types of parameters that a function takes into the name of the function.
- Thus,
- >the function prototype "void xyz(int x)" might look something like "$xyz$qvr"
- >if you examine the object file. This is required in C++ to produce type-safe
- >linkage.
-
- It is not required, either technically or by the standard. It is a common
- implementation technique.
-
- >In C++, you are allowed to have functions that have the same name,
- >but differ only in the number or types of parameters that they take. This is
- >something that is not allowed in normal C. The compiler needs to resolve
- these
- >identical names into unique names for the linker.
-
- Once again, implementation details. There's no inherent reason for linkers to
- require readable names as the only mechanism for resolving references. It just
- happens to be done that way on most systems.
-
- >Thus, the need for mangled
- >names. The problem is that name mangling is not defined as a standard.
- >Therefore, every compiler could use a different scheme and thus be unable to
- >link in libraries created by another compiler.
- >
-
- Even if compilers used the same name mangling schemes, there are enough
- differences in the way objects are laid out and used that you can't, in most
- cases, use code produced by different compilers within the same program, even
- if you could persuade the linker to link the various modules together.
-
-